fix: fail closed on invalid project policy manifests - #242
Conversation
|
View your CI Pipeline Execution ↗ for commit 0956a68
☁️ Nx Cloud last updated this comment at |
commit: |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Team Run ID: 📒 Files selected for processing (5)
Included review availability: Your plan provides up to 2 included reviews per hour; 0 remain after this review. 📝 WalkthroughWalkthroughThe change makes policy manifest handling fail closed for unreadable, malformed, and non-object ChangesFail-closed policy handling
Estimated code review effort: 3 (Moderate) | ~20 minutes Merge Risk: ⚪ Minimal · up to Unreadable, malformed, and non-object policy manifests now stop policy-controlled operations rather than exposing skills, while genuinely missing manifests retain migration behavior. Core and CLI coverage supports the intended error and no-output behavior. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Docstring CoverageExplanation Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 3 files. (2 skipped: 2 unsupported.)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
🎯 Changes
A malformed project
package.jsonwas treated as missing policy, which could turn a deny-all allowlist into migration-mode access to every discovered skill. Policy reads now reject unreadable files, invalid JSON, and non-object manifests with a diagnostic identifying the file. A dangling manifest symlink also fails; genuinely missing manifests retain existing migration behavior.Regression tests cover core listing/loading, inherited exclusions within a resolved workspace, and CLI list/load/default-install/install-map failures without skill output or generated guidance. Includes a patch changeset and trust-model documentation.
Fixes #230.
Workspace-boundary detection remains separate in #240: malformed npm root JSON can hide the workspace itself. This PR handles confirmed project policy files and inherited policy within a resolved workspace.
✅ Checklist
pnpm run test:pr.Verification: 588 unit tests and 73 integration tests passed, along with types, ESLint, Knip, Sherif, documentation links, build, and
git diff --check. Local PR checks usedNX_NO_CLOUD=true,NX_DAEMON=false, a temporary npm cache, andpnpm_config_verify_deps_before_run=falseto reuse installed dependencies in the isolated worktree.🚀 Release Impact
Summary by CodeRabbit
Bug Fixes
Documentation